
package routing;

import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.PublicKey;

/**
 *
 * @author Paweł
 */
public class UserData implements Serializable {
    private String name;
    //private byte[] password;
    private boolean online;
    private PublicKey publicKey;
    private InetAddress inetAddress;

    public PublicKey getPublicKey() {
        return publicKey;
    }

    public String getName() {
        return name;
    }

    /**
     * Get the value of inetAddress
     *
     * @return the value of inetAddress
     */
    public InetAddress getInetAddress() {
        return inetAddress;
    }

    public boolean isOnline() {
        return online;
    }

//    public byte[] getShaPassword() {
//        return password;
//    }

    public void setOnline(boolean active) {
        this.online = active;
    }

    public UserData(String name, PublicKey publicKey, boolean online) throws UnknownHostException {
        this.name = name;
        this.publicKey = publicKey;
        // "zbyt publiczny dostep do hasla"
        //this.password = password;
        inetAddress = InetAddress.getLocalHost();
        this.online = online;
    }

    @Override
    public String toString() {
        return name + ", " + inetAddress + " " + online;
    }
}
